/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.koller.million.card.frame.util;

import java.awt.Component;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author User
 */
public class NewsEntryRenderer extends javax.swing.JPanel implements ListCellRenderer<NewsEntry> {

	/**
	 * Creates new form NewsEntryRenderer
	 */
	public NewsEntryRenderer() {
		initComponents();
	}

	@Override
	public Component getListCellRendererComponent( JList<? extends NewsEntry> list, NewsEntry value, int index, boolean isSelected, boolean cellHasFocus ) {
		if( value != null )
			text.setText( value.toString() );
		else
			text.setText( "" );
		return this;
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        text = new javax.swing.JLabel();

        text.setText("jLabel1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(text, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(text)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel text;
    // End of variables declaration//GEN-END:variables
}
